using UnityEngine;
using System.Collections;

public class Monster_Movement_State : State {
	private Vector3 DirectionToTarget;
	public override void Enter_State(Alive_object _monster_script)
	{
		DirectionToTarget = GameManager.getInstance().TargetObject.transform.position - transform.position;
		DirectionToTarget.Normalize();
		transform.LookAt( GameManager.getInstance().TargetObject.transform.position );
	}
	public override void Excute_State(Alive_object _monster_script)
	{
		
		transform.position += (DirectionToTarget * _monster_script.monster_data_.movement_speed ) * Time.deltaTime;
		
		if( Vector3.Distance(GameManager.getInstance().TargetObject.transform.position
							, transform.position) < _monster_script.monster_data_.attack_range )
		{
			_monster_script.fsm.Change_state(_monster_script.arr_state_[1],_monster_script);
		}
		
	}
	public override void Exit_State(Alive_object _monster_script)
	{
	}
}
